package com.chen.palmar.common.override;

import android.content.Context;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chen.palmar.R;
import com.chen.palmar.common.widget.view.RoundImageView;
import com.youth.banner.loader.ImageLoader;

/**
 * @author Chen
 * @date 2017/12/29
 * 功能描述：
 */

public class BannerImageLoader extends ImageLoader {
    @Override
    public void displayImage(Context context, Object path, ImageView imageView) {
        Glide.with(context)
                .load(path.toString())
                .asBitmap()
                .transform(new GlideRoundTransform(context, 10))
                .placeholder(R.mipmap.banner_bg)
                .error(R.mipmap.banner_bg)
                .fitCenter()
                .into(imageView);
    }

    @Override
    public ImageView createImageView(Context context) {
        RoundImageView roundImageView = new RoundImageView(context);
        roundImageView.setRound(15, 15, 15, 15);
        return roundImageView;
    }
}
